home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / WorldScript.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  9.9 KB  |  363 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        WorldScript.h
  3.  
  4.      Contains:    WorldScript I Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __WORLDSCRIPT__
  19. #define __WORLDSCRIPT__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __TRAPS__
  25. #include <Traps.h>
  26. #endif
  27. #ifndef __QUICKDRAWTEXT__
  28. #include <QuickdrawText.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. typedef UInt16                             WSIOffset;
  54. typedef UInt8                             WSIByteCount;
  55. typedef UInt8                             WSIByteIndex;
  56. /* offset from start of sub-table to row in state table */
  57. typedef UInt16                             WSIStateOffset;
  58. typedef UInt32                             WSITableOffset;
  59. typedef UInt16                             WSISubtableOffset;
  60. typedef UInt16                             WSIGlyphcode;
  61. typedef UInt32                             WSITableIdentifiers;
  62.  
  63. enum {
  64.     kScriptSettingsTag            = FOUR_CHAR_CODE('info'),
  65.     kMetamorphosisTag            = FOUR_CHAR_CODE('mort'),
  66.     kGlyphExpansionTag            = FOUR_CHAR_CODE('g2g#'),
  67.     kPropertiesTag                = FOUR_CHAR_CODE('prop'),
  68.     kJustificationTag            = FOUR_CHAR_CODE('kash'),
  69.     kCharToGlyphTag                = FOUR_CHAR_CODE('cmap'),
  70.     kGlyphToCharTag                = FOUR_CHAR_CODE('pamc'),
  71.     kFindScriptRunTag            = FOUR_CHAR_CODE('fstb')
  72. };
  73.  
  74.  
  75.  
  76. /****             L O O K U P    T A B L E    T Y P E S        ****/
  77.  
  78. enum {
  79.     WSILookupSimpleArray        = 0,                            /* a simple array indexed by glyph code */
  80.     WSILookupSegmentSingle        = 2,                            /* segment mapping to single value */
  81.     WSILookupSegmentArray        = 4,                            /* segment mapping to lookup array */
  82.     WSILookupSingleTable        = 6,                            /* sorted list of glyph, value pairs */
  83.     WSILookupTrimmedArray        = 8                                /* a simple trimmed array indexed by glyph code */
  84. };
  85.  
  86. typedef unsigned short                     WSILookupTableFormat;
  87. typedef unsigned short                     WSILookupValue;
  88. /* An offset from the beginning of the lookup table */
  89. typedef unsigned short                     WSILookupOffset;
  90. /*    FORMAT SPECIFIC DEFINITIONS */
  91. /*
  92.         lookupSimpleArray:
  93.         
  94.         This is a simple array which maps all glyphs in the font
  95.         to lookup values.
  96.     */
  97.  
  98. struct WSILookupArrayHeader {
  99.     WSILookupValue                     lookupValues[1];            /* The array of values indexed by glyph code */
  100. };
  101. typedef struct WSILookupArrayHeader        WSILookupArrayHeader;
  102. /*
  103.         lookupTrimmedArray:
  104.         
  105.         This is a single trimmed array which maps a single range
  106.         of glyhs in the font to lookup values.
  107.     */
  108.  
  109. struct WSILookupTrimmedArrayHeader {
  110.     WSIGlyphcode                     firstGlyph;
  111.     WSIGlyphcode                     limitGlyph;
  112.     WSILookupValue                     valueArray[1];
  113. };
  114. typedef struct WSILookupTrimmedArrayHeader WSILookupTrimmedArrayHeader;
  115. /* The format specific part of the subtable header */
  116.  
  117. union WSILookupFormatSpecificHeader {
  118.     WSILookupArrayHeader             simpleArray;                /* rename lookupArray as simpleArray <9> */
  119.     WSILookupTrimmedArrayHeader     trimmedArray;
  120. };
  121. typedef union WSILookupFormatSpecificHeader WSILookupFormatSpecificHeader;
  122. /* The overall subtable header */
  123.  
  124. struct WSILookupTableHeader {
  125.     WSILookupTableFormat             format;                        /* table format */
  126.     WSILookupFormatSpecificHeader     fsHeader;                    /* format specific header */
  127. };
  128. typedef struct WSILookupTableHeader        WSILookupTableHeader;
  129.  
  130. /****        G L Y P H    E X P A N S I O N    ****/
  131.  
  132. enum {
  133.                                                                 /* fixed 1.0 */
  134.     kCurrentGlyphExpansionVersion = 0x00010000
  135. };
  136.  
  137.  
  138. typedef unsigned short                     GlyphExpansionFormats;
  139.  
  140. enum {
  141.     GlyphExpansionLookupFormat    = 1,
  142.     GlyphExpansionContextualFormat = 2
  143. };
  144.  
  145.  
  146. struct ExpandedGlyphCluster {
  147.     WSIByteCount                     numGlyphs;
  148.     WSIByteIndex                     bestGlyph;
  149.     WSIGlyphcode                     glyphs[1];
  150. };
  151. typedef struct ExpandedGlyphCluster        ExpandedGlyphCluster;
  152.  
  153. struct ExpandedGlyphOffset {
  154.     WSIGlyphcode                     glyph;
  155.     WSIOffset                         offset;                        /* offset to ExpandedGlyphCluster */
  156. };
  157. typedef struct ExpandedGlyphOffset        ExpandedGlyphOffset;
  158.  
  159. struct GlyphExpansionStateTable {
  160.     WSISubtableOffset                 stateTableOffset;
  161.     WSISubtableOffset                 classTableOffset;
  162.     WSISubtableOffset                 actionTableOffset;            /* state, class and actions tables follow here... */
  163. };
  164. typedef struct GlyphExpansionStateTable    GlyphExpansionStateTable;
  165.  
  166. struct GlyphExpansionTable {
  167.     Fixed                             version;
  168.     short                             format;
  169.     short                             expansionNumer;
  170.     short                             expansionDenom;                /* num/denom ratio for expansion <2> */
  171.  
  172.     union {
  173.         GlyphExpansionStateTable         stateTable;
  174.         WSILookupTableHeader             lookup;                    /* expanded glyph clusters follow here... */
  175.     }                                 table;
  176. };
  177. typedef struct GlyphExpansionTable        GlyphExpansionTable;
  178.  
  179. /* Glyph-to-Character constants and types  */
  180.  
  181. enum {
  182.     kCurrentGlyphToCharVersion    = 0x00010100
  183. };
  184.  
  185.  
  186. typedef unsigned short                     GlyphToCharLookupFormats;
  187.  
  188. enum {
  189.     kGlyphToCharLookup8Format    = 1,
  190.     kGlyphToCharLookup16Format    = 2,
  191.     kGlyphToCharLookup32Format    = 3
  192. };
  193.  
  194. typedef UInt8                             GlyphToCharFontIndex;
  195. typedef UInt8                             QDGlyphcode;
  196.  
  197. struct GlyphToCharActionTable {
  198.     WSISubtableOffset                 fontNameOffset;                /* offset relative to this table */
  199.     WSILookupTableHeader             actions;                    /* only support lookupSimpleArray format for now */
  200. };
  201. typedef struct GlyphToCharActionTable    GlyphToCharActionTable;
  202.  
  203. struct GlyphToCharActionHeader {
  204.     short                             numTables;                    /* 0..n */
  205.     WSISubtableOffset                 offsets[1];                    /* offsets from start of action table header */
  206. };
  207. typedef struct GlyphToCharActionHeader    GlyphToCharActionHeader;
  208.  
  209. struct GlyphToCharHeader {
  210.     Fixed                             version;
  211.  
  212.     WSISubtableOffset                 actionOffset;                /* offset to GlyphToCharActionHeader */
  213.  
  214.     short                             format;                        /* size of font mask */
  215.     WSILookupTableHeader             mappingTable;
  216. };
  217. typedef struct GlyphToCharHeader        GlyphToCharHeader;
  218.  
  219. /* JUSTIFICATION TYPES
  220.     WorldScript supports justification of text using insertion. The justification
  221.     table specifies a insertion string to insert between 2 specified glyphs.
  222.     Each combination of inter-glyph boundary can be assigned a justification priority,
  223.     the higher the priority the more justification strings inserted at that position.
  224.     
  225.     The priorities for each inter-glyph boundary are specified by the justification table's
  226.     state table.
  227.     
  228.     Special handling is done for scripts which use spaces to justify, because the width of 
  229.     a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  230.     per inserting string is specified in the justification table.
  231.  
  232. */
  233.  
  234. enum {
  235.                                                                 /* 1.0 not supported */
  236.     kCurrentJustificationVersion = 0x0200
  237. };
  238.  
  239.  
  240. enum {
  241.     kJustificationStateTableFormat = 1
  242. };
  243.  
  244.  
  245. enum {
  246.                                                                 /* WSI's internal limitation <12> */
  247.     kMaxJustificationStringLength = 13
  248. };
  249.  
  250.  
  251. typedef UInt8                             WSIJustificationPriority;
  252.  
  253. enum {
  254.     WSIJustificationSetMarkMask    = 0x80
  255. };
  256.  
  257.  
  258. struct WSIJustificationStateEntry {
  259.     WSIJustificationPriority         markPriority;                /* non-zero priorities means insertion */
  260.     WSIJustificationPriority         priority;
  261.     WSIStateOffset                     newState;
  262. };
  263. typedef struct WSIJustificationStateEntry WSIJustificationStateEntry;
  264.  
  265. typedef unsigned short                     WSIJustificationClasses;
  266.  
  267. enum {
  268.     wsiJustEndOfLineClass        = 0,
  269.     wsiJustEndOfRunClass        = 1,
  270.     wsiJustDeletedGlyphClass    = 2,
  271.     wsiJustUserDefinedClass        = 3
  272. };
  273.  
  274. typedef unsigned short                     WSIJustificationStates;
  275.  
  276. enum {
  277.     wsiStartOfLineState            = 0,                            /* pre-defined states */
  278.     wsiStartOfRunState            = 1,
  279.     wsiUserDefinedState            = 2
  280. };
  281.  
  282. /* pre-multiplied: class# * sizeof(WSIJustificationStateEntry) */
  283. typedef UInt8                             WSIJustificationClassOffset;
  284.  
  285. struct WSIJustificationStateTable {
  286.     short                             maxPriorities;
  287.     unsigned short                     rowWidth;                    /* width of a state table row in bytes */
  288.     short                             classTableOffset;
  289.     short                             stateTableOffset;
  290. };
  291. typedef struct WSIJustificationStateTable WSIJustificationStateTable;
  292. /*
  293.             Last two fields of above structure - someday?
  294.             WSIJustificationClassOffset    classes[up to 64 classes supported];
  295.             WSIJustificationStateEntry    states[up to your heart's desire];
  296.         */
  297.  
  298. struct WSIJustificationHeader {
  299.     short                             version;
  300.     short                             format;
  301.  
  302.     Point                             scaling;                    /* numer/denom scaling of priority weights <7> */
  303.  
  304.     unsigned short                     spacesPerInsertion;            /* # of $20 chars in justification insertion string <12> */
  305.     unsigned short                     justStringOffset;            /* offset to justification string */
  306.  
  307.  
  308.     WSIJustificationStateTable         stateTable;                    /* long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows */
  309. };
  310. typedef struct WSIJustificationHeader    WSIJustificationHeader;
  311.  
  312. /* Line Layout's Property table version <11> */
  313.  
  314. enum {
  315.                                                                 /* v1.0 */
  316.     currentPropsTableVersion    = 0x00010000
  317. };
  318.  
  319.  
  320. enum {
  321.                                                                 /* version is octal 0100 or hex 0x40 (#64) */
  322.     kCharToGlyphCurrentVersion    = 0x40
  323. };
  324.  
  325. /* pass as priorityWeight to JustifyWSILayout to use script's current just setting */
  326.  
  327. enum {
  328.     kScriptsDefaultJustWeight    = -1
  329. };
  330.  
  331.  
  332. /* feature selectors used in FindScriptRun and itl5 configuration tables <9> */
  333.  
  334. typedef UInt16                             WSIFeatureType;
  335. typedef UInt16                             WSIFeatureSelector;
  336.  
  337. struct WSIFeature {
  338.     WSIFeatureType                     featureType;
  339.     WSIFeatureSelector                 featureSelector;
  340. };
  341. typedef struct WSIFeature                WSIFeature;
  342.  
  343. #if PRAGMA_STRUCT_ALIGN
  344.     #pragma options align=reset
  345. #elif PRAGMA_STRUCT_PACKPUSH
  346.     #pragma pack(pop)
  347. #elif PRAGMA_STRUCT_PACK
  348.     #pragma pack()
  349. #endif
  350.  
  351. #ifdef PRAGMA_IMPORT_OFF
  352. #pragma import off
  353. #elif PRAGMA_IMPORT
  354. #pragma import reset
  355. #endif
  356.  
  357. #ifdef __cplusplus
  358. }
  359. #endif
  360.  
  361. #endif /* __WORLDSCRIPT__ */
  362.  
  363.